package javaBase.javaInnerClass.anonymousInnerClass;

/**
 * Created by Administrator on 2017/2/22 0022.
 */
public class OuterClass {
    public InnerClass getInnerClass(final int num,  final String str2) {
        return new InnerClass() {
            int number = num + 3;
            public int getNumber() {
                System.out.println(str2);
                return number;
            }
        };        /* 注意：分号不能省 */
    }

    public static void main(String[] args) {
        OuterClass out = new OuterClass();
        InnerClass inner = out.getInnerClass(2, "chenssy");
        System.out.println(inner.getNumber());
    }
}
